#include "stdafx.h"

#include "game.h"

Game::Game( void ) : RenderSurface( 1, 1 )
{
    mClouds = new Cloud*[3];

    mnClouds = 3;
}

Game::~Game( void )
{
    for( int i = 0 ; i < mnClouds ; ++i )
    {
        delete mClouds[i];
    }

    delete[] mClouds;
}

void Game::Init( void )
{
    mTextureManager->LoadImage( "data/FluidParticle.png" );
    mFontManager->LoadFont( "data/testfont.ttf", 10 );

    mClouds[0] = new Cloud( Vector2( -25.0f, -25.0f ), Color( 5, 40, 127 ) );
    mClouds[0]->SetTextureName( mTextureManager->GetTexture( 0 ) );

    mClouds[1] = new Cloud( Vector2( -15.0f, -8.0f ), Color( 40, 80, 4 ) );
    mClouds[1]->SetTextureName( mTextureManager->GetTexture( 0 ) );

    mClouds[2] = new Cloud( Vector2( 6.0f, -2.0f ), Color( 150, 10, 60 ) );
    mClouds[2]->SetTextureName( mTextureManager->GetTexture( 0 ) );
}

void Game::Render( void )
{
    glPushMatrix();
		glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_COLOR );

		for( int i = 0 ; i < mnClouds ; ++i )
        {
            World::Tick();
            mClouds[i]->Render();
        }
	glPopMatrix();
}

void Game::HandleInput( bool *keys )
{
    if( keys[VK_SPACE] )
    {

    }
}
